If your system can boot to one or more operating
systems other than Windows 7, or to multiple installations of Windows
7, you’ll see a menu similar to the following during startup:
Choose the operating system or tool you want to start:
(Use the arrow keys to highlight your choice.)
Earlier version of Windows
Windows 7
To specify an advanced option for this choice, press F8.
Seconds until highlighted choice will be started automatically: 30
Tools:
Windows Memory Diagnostic
If
you do nothing at this point, Windows 7 will boot automatically after
30 seconds. Otherwise, you select the operating system you want and
then press the Enter key to boot it. (To switch between the operating
system menu and the Tools menu, press the Tab key.) The specifics of
this menu are determined by the Boot Configuration Data (BCD), a new data store that replaces the BOOT.INI file used in earlier versions of Windows. BOOT.INI
still exists, but it’s used only for loading the legacy operating
systems in multiboot setups. Why the change? There are three main
reasons:
It
didn’t make sense to have two different types of boot information
stores: one for BIOS-based systems and another for EFI-based systems.
BCD creates a common store for both types of operating systems.
The need to support boot applications,
which refers to any process that runs in the boot environment that the
Windows Boot Manager creates. The main types of boot applications are
Windows 7 partitions, legacy installations of Windows, and startup
tools, such as the Windows Memory Diagnostic that appears in the
Windows Boot Manager menu. In this sense, Windows Boot Manager is a
kind of miniature operating system that displays an interface (the
Windows Boot Manager menu) that lets you select which application you
want to run.
The
need to make boot options scriptable. The BCD exposes a scripting
interface via a Windows Management Instrumentation (WMI) provider. This
enables you to create scripts that modify all aspects of the BCD.
Windows 7 gives you four methods to modify some or all the data in the BCD store:
The Startup and Recovery feature
The System Configuration utility
The BCDEDIT command-line utility
The BCD WMI provider
Using Startup and Recovery to Modify the BCD
You
can modify a limited set of BCD options using the Startup and Recovery
dialog box: the default operating system, the maximum time the Windows
Boot Manager menu is displayed, and the maximum time the Windows 7
startup recovery options are displayed. Here are the steps to follow:
1. | Select Start, right-click Computer, and then click Properties. Windows 7 displays Control Panel’s System window.
|
2. | Click Advanced System Settings. The System Properties dialog box appears.
Tip
Another way to get to the System Properties dialog box is to select Start, type systempropertiesadvanced, and then press Enter.
|
3. | In
the Advanced tab, click the Settings button in the Startup and Recovery
group. Windows 7 displays the Startup and Recovery dialog box, shown in
Figure 1.
|
4. | Use
the Default Operating System list to click the operating system that
Windows Boot Manager highlights by default at startup. (In other words,
this is the operating system that runs automatically if you do not make
a choice in the Windows Boot Manager menu.)
|
5. | Use
the Time to Display List of Operating Systems spin box to set the
interval after which Windows Boot Manager launches the default
operating system. If you don’t want Windows Boot Manager to select an
operating system automatically, deactivate the Time to Display List of
Operating Systems check box.
|
6. | If
Windows 7 is not shut down properly, Windows Boot Manager displays a
menu of recovery options at startup. If you want the default options
selected automatically after a time interval, activate the Time to
Display Recovery Options When Needed check box and use the associated
spin box to set the interval.
|
7. | Click OK in all open dialog boxes to put the new settings into effect.
|
Using the System Configuration Utility to Modify the BCD
For
more detailed control over the BCD store, you can modify the data by
using the System Configuration Utility. To start this program, follow
these steps:
1. | Select Start, type msconfig, and then press Enter. The System Configuration Utility window appears.
|
2. | Select the Boot tab, shown in Figure 2.
|
The large box near the top of the tab displays the Windows 7 installations on the current computer. You see Current OS beside the Windows 7 installation you are running now; you see Default OS beside the Windows 7 installation that is set up as the default. There are four main tasks you can perform:
Click the Set as Default button to set the highlighted Windows 7 install as the default for the Windows Boot Manager menu.
Use the Timeout text box to set the maximum time that Windows Boot Manager waits before selecting the default OS.
Use
the check boxes in the Boot Options group to set the following startup
options for the currently highlighted Windows 7 install:
Safe Boot: Minimal— Boots Windows 7 in Safe mode,
which uses only a minimal set of device drivers. Use this switch if
Windows 7 won’t start, if a device or program is causing Windows 7 to
crash, or if you can’t uninstall a program while Windows 7 is running
normally.
Safe Boot: Minimal (Alternate Shell)—
Boots Windows 7 in Safe mode but also bypasses the Windows 7 GUI and
boots to the Command Prompt instead. Use this switch if the programs
you need to repair a problem can be run from the Command Prompt or if
you can’t load the Windows 7 GUI.
Note
The shell loaded by the /safeboot:minimal(alternateshell) switch is determined by the value in the following Registry key:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\SafeBoot\AlternateShell
The default value is cmd.exe (the Command Prompt).
Safe Boot: Active Directory Repair—
Boots Windows 7 in Safe mode and restores a backup of the Active
Directory service. (This option applies only to domain controllers.)
Safe Boot: Network—
Boots Windows 7 in Safe mode but also includes networking drivers. Use
this switch if the drivers or programs you need to repair a problem
exist on a shared network resource, if you need access to email or
other network-based communications for technical support, or if your
computer is running a shared Windows 7 installation.
No GUI Boot—
Tells Windows 7 not to load the VGA display driver that is normally
used to display the progress bar during startup. Use this switch if
Windows 7 hangs while switching video modes for the progress bar, or if
the display of the progress bar is garbled.
Boot Log— Boots Windows 7 and logs the boot process to a text file named ntbtlog.txt that resides in the %SystemRoot%
folder. Move to the end of the file and you might see a message telling
you which device driver failed. You probably need to reinstall or roll
back the driver. Use this switch if the Windows 7 startup
hangs, if you need a detailed record of the startup process, or if you
suspect (after using one of the other Startup menu options) that a
driver is causing Windows 7 startup to fail.
Note
%SystemRoot% refers to the folder into which Windows 7 was installed. This is usually C:\Windows.
Base Video—
Boots Windows 7 using the standard VGA mode: 640×480 with 256 colors.
This is useful for troubleshooting video display driver problems. Use
this switch if Windows 7 fails to start using any of the Safe mode
options, if you recently installed a new video card device driver and
the screen is garbled, the driver is balking at a resolution or color
depth setting that’s too high, or if you can’t load the Windows 7 GUI.
After Windows 7 has loaded, you can reinstall or roll back the driver,
or you can adjust the display settings to values that the driver can
handle.
OS Boot Information—
Displays the path and location of each device driver as it loads, as
well as the operating system version and build number, the number of
processors, the system memory, and the process type.
Click the Advanced Options button to display the BOOT Advanced Options dialog box shown in Figure 4.3. You can set the following options:
Number of Processors—
In a multiprocessor system, specifies the maximum of processors that
Windows 7 can use. Activate this check box if you suspect that using
multiple processors is causing a program to hang.
Maximum Memory—
Specifies the maximum amount of memory, in megabytes, that Windows 7
can use. Use this value when you suspect a faulty memory chip might be
causing problems.
PCI Lock—
Activate this check box to tell Windows 7 not to dynamically assign
hardware resources for PCI devices during startup. The resources
assigned by the BIOS during the POST are locked in place. Use this
switch if installing a PCI device causes the system to hang during
startup.
Detect HAL— Activate this check box to force Windows 7 to detect the computer’s hardware abstraction layer (HAL)
at startup. The HAL is a software layer that resides between the
computer’s hardware and the operating system kernel, and its job is to
hide hardware differences so that the kernel can run on a variety of
hardware. If you force Windows 7 to detect the HAL, it can use the HAL
to interact with the computer’s hardware at startup. This is useful if
dealing with the hardware directly is causing startup problems.
Debug—
Enables remote debugging of the Windows 7 kernel. This sends debugging
information to a remote computer via one of your computer’s ports. If
you use this switch, you can use the Debug Port list to specify a
serial port, IEEE 1394 port, or USB port. If you use a serial port, you
can specify the transmission speed of the debugging information using
the Baud Rate list; if you use an IEEE 1394 connection, activate
Channel and specify a channel value; if you use a USB port, type the
device name in the USB Target Name text box.
Using BCDEDIT to Customize the Startup Options
The
System Configuration utility makes it easy to modify BCD store items,
but it doesn’t give you access to the entire BCD store. For example,
the Boot tab doesn’t list any legacy boot items on your system, and
there are no options for renaming boot items or for changing the order
in which the boot items are displayed in the Windows Boot Manager menu.
For these tasks, and indeed for every possible BCD task, you need to
use the BCDEDIT command-line tool.
Note that BCDEDIT
is an administrator-only tool, so you must run it under the
Administrator account (not just any account in the Administrators
group). The easiest way to do this is to elevate your privileges when
running the Command Prompt, as described in the following steps:
1. | Select Start and type command in the Search box. Command Prompt appears at the top of the search results.
|
2. | Right-click Command Prompt and then click Run as Administrator. The User Account Control dialog box appears.
|
3. | Either click Continue or type an administrator password and click Submit. The Command Prompt window appears
|
Table 1 summarizes the switches you can use with BCDEDIT.
Table 1. Switches Available for the BCDEDIT Command-Line Tool
Switch | Description |
---|
/bootdebug | Toggles boot debugging for a boot application on and off |
/bootems | Toggles Emergency Management Services for a boot application on and off |
/bootsequence | Sets the one-time boot sequence for the boot manager |
/copy | Makes a copy of an entry |
/create | Creates a new entry |
/createstore | Creates a new and empty BCD store |
/dbgsettings | Sets the global debugger settings |
/debug | Toggles kernel debugging for an operating system entry |
/default | Sets the default entry |
/delete | Deletes an entry |
/deletevalue | Deletes an entry value |
/displayorder | Sets the order in which Boot Manager displays the operating system entries |
/ems | Enables or disables Emergency Management Services for an operating system entry |
/emssettings | Sets the global Emergency Management Services settings |
/enum | Lists the entries in the BCD store |
/export | Exports the contents of the BCD store to a file |
/import | Restores the BCD store from a backup file created with the /export switch |
/mirror | Creates a mirror of an entry |
/set | Sets an option value for an entry |
/store | Specifies the BCD store to use |
/timeout | Sets the Boot Manager timeout value |
/toolsdisplayorder | Sets the order in which Boot Manager displays the Tools menu |
/types | Displays the data types required by the /set and /deletevalue commands |
/v | Displays all entry identifiers in full, instead of using well-known identifiers |
To help you understand how BCDEDIT works, let’s examine the output that appears when you run BCDEDIT with the /enum switch:
Windows Boot Manager
--------------------
identifier {bootmgr}
device partition=\Device\HarddiskVolume1
description Windows Boot Manager
locale en-US
inherit {globalsettings}
default {current}
resumeobject {53c701aa-e1c3-11dd-9af1-8cfcc639165e}
displayorder {ntldr}
{current}
toolsdisplayorder {memdiag}
timeout 30
Windows Legacy OS Loader
------------------------
identifier {ntldr}
device partition=\Device\HarddiskVolume1
path \ntldr
description Earlier Version of Windows
Windows Boot Loader
-------------------
identifier {current}
device partition=C:
path \Windows\system32\winload.exe
description Windows 7
locale en-US
inherit {bootloadersettings}
recoverysequence {53c701ac-e1c3-11dd-9af1-8cfcc639165e}
recoveryenabled Yes
osdevice partition=C:
systemroot \Windows
resumeobject {53c701aa-e1c3-11dd-9af1-8cfcc639165e}
nx OptIn
As you can see, this BCD store has three entries: one for Windows Boot
Manager, one for a legacy Windows install, and one for a Windows 7
install. Notice that each entry has an Identifier setting, and these IDs are unique to each entry. All IDs are actually 32-digit globally unique identifiers (GUIDs), but by default BCDEDIT works with a collection of well-known identifiers, including the following (type bcdedit id /? to see the complete list):
bootmgr | The Windows Boot Manager entry |
ntldr | An entry that uses a legacy operating system loader (NTLDR) to boot earlier versions of Windows |
current | The entry that corresponds to the operating system that is currently running |
default | The entry that corresponds to the Windows Boot Manager default operating system |
memdiag | The Windows Memory Diagnostics entry |
If you want to see the full GUIDs for every entry, add the /v (verbose) switch:
It would take dozens of pages to run through all the BCDEDIT switches, so I’ll just give you a few examples so you can get a taste of how this powerful utility operates.
Making a Backup Copy of the BCD Store
Before
you do any work on the BCD store, you should make a backup copy. That
way, if you make an error when you change something in the BCD, you can
always restore the backup copy to get your system back to its original
state.
You create a backup copy using the /export switch. For example, the following command backs up the BCD store to a file named bcd_backup in the root folder of the C: drive:
bcdedit /export c:\bcd_backup
If you need to restore the backup, use the /import switch, as in this example:
bcdedit /import c:\bcd_backup
Renaming an Entry
The
names that Windows Boot Manager assigns to the boot applications leave
a lot to be desired. For a legacy operating system entry, for example,
the default Earlier Version of Windows is not particularly descriptive.
A simpler name such as Windows XP Pro would be much more useful.
Similarly, all Windows 7 installs get the same name: Windows 7, which
can be quite confusing. Names such as Windows 7 Home Premium and
Windows 7 Ultimate would be much more understandable.
To rename an entry using BCDEDIT, use the following syntax:
bcdedit /set {id} description "name"
Here, replace id with the entry identifier (the GUID or the well-known identifier, if applicable) and replace name
with the new name you want to use. For example, the following command
replaces the current name of the legacy operating system entry (ntldr) with Windows XP Pro:
bcdedit /set {ntldr} description "Windows XP Pro"
Tip
GUIDs are 32-character values, so typing them by hand is both time-consuming and error-prone. To avoid this, first run the bcdedit /enum
command to enumerate the BCD entries, and then scroll up until you see
the GUID of the entry with which you want to work. Pull down the system
menu (click the upper-left corner of the window or press Alt+spacebar),
select Edit, Mark, click-and-drag over the GUID to select it, and then
press the Enter key to copy it. Begin typing your BCDEDIT command, and when you get to the part where the identifier is required, pull down the system menu again and select Edit, Paste.
Changing the Order of the Entries
If you’d prefer that the Boot Manager menu entries appear in a different order, you can use BCDEDIT’s /displayorder
switch to change the order. In the simplest case, you might want to
move an entry to either the beginning or the end of the menu. To send
an entry to the beginning, include the /addfirst switch. Here’s an example:
bcdedit /displayorder {a8ef3a39-a0a4-11da-bedf-97d9bf80e36c} /addfirst
To send an entry to the end of the menu, include the /addlast switch instead, as in this example:
bcdedit /displayorder {current} /addfirst
To set the overall order, include each identifier in the order you want, separated by spaces:
bcdedit /displayorder {current} {a8ef3a39-a0a4-11da-bedf-97d9bf80e36c} {ntldr}